11. Exercise: Make a Preference Fragment
Exercise Code
In this exercise, you will be creating a SettingsFragment.
Exercise: T06.02-Exercise-MakeAPreferenceFragment
Make a Preference Fragment Exercise Two
SOLUTION:
- Add the gradle dependency for the support preference fragment
- Create the SettingsFragment class that extends PreferenceFragmentCompat
- Create the pref_visualizer in res->xml
- Add a CheckBoxPreference to the preference
- Call addPreferencesFromResource method to add the preference file
- Add a preference theme to styles.xml